package org.unicode.icu4x

import com.sun.jna.Callback
import com.sun.jna.Library
import com.sun.jna.Native
import com.sun.jna.Pointer
import com.sun.jna.Structure

internal interface DecomposedLib: Library {
}

internal class DecomposedNative: Structure(), Structure.ByValue {
    @JvmField
    internal var first: Int = 0;
    @JvmField
    internal var second: Int = 0;

    // Define the fields of the struct
    override fun getFieldOrder(): List<String> {
        return listOf("first", "second")
    }
}

/** The outcome of non-recursive canonical decomposition of a character.
*`second` will be NUL when the decomposition expands to a single character
*(which may or may not be the original one)
*
*See the [Rust documentation for `Decomposed`](https://docs.rs/icu/2.1.1/icu/normalizer/properties/enum.Decomposed.html) for more information.
*/
class Decomposed internal constructor (
    internal val nativeStruct: DecomposedNative) {
    val first: Int = nativeStruct.first
    val second: Int = nativeStruct.second

    companion object {
        internal val libClass: Class<DecomposedLib> = DecomposedLib::class.java
        internal val lib: DecomposedLib = Native.load("icu4x", libClass)
        val NATIVESIZE: Long = Native.getNativeSize(DecomposedNative::class.java).toLong()
    }

}
